package com.cdp.system.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cdp.common.core.domain.entity.SysSandFineness;
import com.cdp.common.core.domain.entity.SysSandType;
import com.cdp.system.dto.SandTypeDTO;
import com.cdp.system.mapper.SysSandTypeMapper;
import com.cdp.system.service.ISysSandTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SysSandTypeServiceImpl extends ServiceImpl<SysSandTypeMapper,SysSandType >  implements ISysSandTypeService {

@Autowired
private SysSandTypeMapper sysSandTypeMapper;

    /**
     * 查询砂类型
     * @return
     */

    @Override
    public List<SysSandType> listSandType() {
        List<SysSandType> list = list();
        return  list;
    }

    /**
     * 砂类型模糊查询
     * @param sandTypeDTO
     * @return
     */
    @Override
    public List<SysSandType> listMistedSandType(SandTypeDTO sandTypeDTO) {
        LambdaQueryWrapper<SysSandType> wrapper = new LambdaQueryWrapper<>();

        // 如果传入的 name 不为空
        if (sandTypeDTO.getName() != null && !sandTypeDTO.getName().isEmpty()) {
            wrapper.like(SysSandType::getName, sandTypeDTO.getName());
        }

        // 执行查询
        return sysSandTypeMapper.selectList(wrapper);
    }




}
